﻿namespace TC
{
    public class IntAdd_blueprint : TranslateBlueprint
    {
        public override editor.cfg.blueprint.Node OnTranslate(Node node)
        {
            IntAdd t = node as IntAdd;

            editor.cfg.blueprint.IntAdd re = new editor.cfg.blueprint.IntAdd();
            re.id = t.id;
            Port other = null;
            foreach (var i in t.items)
            {
                other = t.graph.GetConnect(i);
                if(other == null)
                {
                    re.inputs.Add(new editor.cfg.blueprint.ConstInt() { value = i.defaultValue });
                }
                else
                {
                    re.inputs.Add(new editor.cfg.blueprint.OutputPin() { nodeId = other.parent.id, pinName = other.name});
                }
            }
            return re;
        }
    }
}
